<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>Axios入门案例</title>
	</head>
	<body>
		
		<!-- 1.导入js类库 -->
		<script src="../js/axios.js"></script>
		<script>
			
			axios.defaults.baseURL="http://localhost:8090/"
			//1.定义方法
			async function getHello(){
				const result = await axios.get("hello")
				console.log(result.data)
			}
			// async function getHello(){
			// 	const {data:str}=await axios.get("hello")
			// 	console.log(str)
			// }
			//练习2：
			async function axiosId(){
				const{data:value}=await axios.get("axios?id=100")
				console.log(value)
			}
			//调用函数
			getHello();
			axiosId();
		</script>
	</body>
</html>
